<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <style>
        body {
            background-color: #fff
        }

        * {
            margin: 0;
            padding: 0
        }

        button {
            margin: 0;
            padding: 0;
            border: 1px solid transparent;
            outline: none;
        }

        #header {
            background: #fff;
            height: 50px;
        }

        #back {
            float: left;
            width: 10%;
        }

        #back img {
            width: 16px;
            height: 16px;
            margin: 17px
        }

        #wen {
            width: 80%;
            text-align: center;
            float: left;
            display: table;
        }

        #wen h4 {
            color: #333333;
            line-height: 50px;
            font-size: 14px
        }

        #search {
            width: 10%;
            float: right;
        }

        #search img {
            width: 16px;
            height: 16px;
            margin: 17px;
            margin-right: 10px
        }

        #xm_cont {
            padding-top: 5px;
            margin-top: 10px;
            border-top: 1px solid #F5F5F5;
            padding-bottom: 20px;
            border-bottom: 1px solid #F5F5F5;
        }

        #xm_cont .title {
            font-size: 14px;
            height: 42px;
            background: #FFF
        }

        #xm_cont .title span {
            display: block;
            float: left;
            width: 3px;
            height: 12px;
            background: #fc8622;
            line-height: 52px;
            margin-left: 15px;
            margin-right: 12px;
            margin-top: 15px
        }

        #xm_cont .title h3 {
            float: left;
            line-height: 42px;
            color: #333333;
            font-size: 14px
        }

        #xm_cont .cont_n {
            width: 90%;
            margin: 5px auto;
            color: #999;
            font-size: 14px;
            line-height: 2em;
            margin-top: 0px;
        }

        #tp_cont {
            border-bottom: 1px solid #F5F5F5;
            padding-bottom: 220px
        }

        #tp_cont .title {
            font-size: 14px;
            height: 52px;
            background: #FFF
        }

        #tp_cont .title span {
            display: block;
            float: left;
            width: 3px;
            height: 12px;
            background: #fc8622;
            line-height: 52px;
            margin-left: 15px;
            margin-right: 12px;
            margin-top: 20px
        }

        #tp_cont .title h3 {
            float: left;
            line-height: 52px;
            color: #333333;
            font-size: 14px
        }

        #tp_cont .cont_n {
            width: 90%;
            margin: 3px auto;
            color: #999;
            font-size: 14px;
            line-height: 2em
        }

        #tp_cont .cont_n img {
            float: left;
            width: 30%;
            height: 94px;
            margin: 5px
        }

        #lxr_cont {
            margin-top: 28px;
            border-top: 1px solid #F5F5F5;
            padding-bottom: 60px
        }

        #lxr_cont .title {
            font-size: 14px;
            height: 52px;
            background: #FFF
        }

        #lxr_cont .title span {
            display: block;
            float: left;
            width: 3px;
            height: 12px;
            background: #fc8622;
            line-height: 52px;
            margin-left: 15px;
            margin-right: 12px;
            margin-top: 20px
        }

        #lxr_cont .title h3 {
            float: left;
            line-height: 52px;
            color: #333333;
            font-size: 14px
        }

        #lxr_cont .cont_n {
            width: 90%;
            margin: 3px auto;
            color: #999;
            font-size: 14px;
            margin-top: 0;
        }

        #lxr_cont .cont_n .tou {
            width: 58px;
            height: 58px;
            float: left;
        }

        #lxr_cont .cont_n .tou img {
            width: 58px;
            height: 58px;
            border-radius: 50%;
        }

        #lxr_cont .cont_n .cont_n_c {
            float: left;
            margin-left: 20px
        }

        #lxr_cont .cont_n .cont_n_c h4 {
            color: #333333;
            font-size: 14px;
            margin-top: 5px;
            margin-right: 8px;
            display: inline-block;
        }

        #lxr_cont .cont_n .cont_n_c img {
            display: inline-block;
            ;
            width: 50px;
            height: 13px;
            vertical-align: middle;
        }

        #lxr_cont .cont_n .cont_n_c .dizhi {
            margin-top: 8px
        }

        #lxr_cont .cont_n .cont_n_c .dizhi span {
            display: block;
            float: left;
        }

        #lxr_cont .cont_n .cont_n_c .dizhi span b {
            font-weight: normal;
        }

        #lxr_cont .cont_n .cont_n_c .dizhi span img {
            width: 12px;
            height: 12px
        }

        .xianshi {
            display: none
        }

        .xianshi .cont_n {
            width: 90%;
            margin: 3px auto;
            color: #999;
            font-size: 14px;
            margin-bottom: 20px;
        }

        .xianshi .cont_n .tou {
            width: 58px;
            height: 58px;
            float: left;
        }

        .xianshi .cont_n .tou img {
            width: 58px;
            height: 58px;
            border-radius: 50%;
        }

        .xianshi .cont_n .cont_n_c {
            float: left;
            margin-left: 20px
        }

        .xianshi .cont_n .cont_n_c h4 {
            color: #333333;
            font-size: 14px;
            margin-top: 5px;
            margin-right: 8px;
            display: inline-block;
        }

        .xianshi .cont_n .cont_n_c img {
            display: inline-block;
            width: 50px;
            height: 13px;
            vertical-align: middle;
        }

        .xianshi .cont_n .cont_n_c .dizhi {
            margin-top: 8px
        }

        .xianshi .cont_n .cont_n_c .dizhi span {
            display: block;
            float: left;
        }

        .xianshi .cont_n .cont_n_c .dizhi .xinyong {
            float: left;
            ;
            margin-top: 2px
        }

        #top .fot span:nth-child(2n+1) {
            margin-right: 5px;
        }

        .xianshi .cont_n .cont_n_c .dizhi span img {
            width: 12px;
            height: 12px
        }

        .xianshi .cont_n h5 {
            float: right;
            color: #999999;
            font-size: 11px;
            margin-top: 5px
        }

        .xscl {
            display: block;
        }

        #top {
            padding-left: 15px;
            margin-top: 15px;
        }

        #top h3 {
            font-size: 14px;
            color: #333;
            padding-bottom: 8px;
            padding-top: 10px;
            width: 100%
        }

        #top h4 {
            float: right;
            margin-right: 15px;
            margin-top: -30px;
            font-size: 12px;
            color: #ccc
        }

        #top .fot span {
            font-size: 12px;
            color: #999999;
            display: block;
            float: left;
        }

        #top .fot img {
            width: 12px;
            height: 12px;
            margin-top: 3px
        }

        nav {
            float: left;
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-orient: horizontal;
            -webkit-flex-flow: row;
            flex-flow: row;
            position: relative;
            width: 70%;
            margin-left: 4.5%;
            height: 50px;
        }

        nav .menu {
            -webkit-box-flex: 1;
            -webkit-flex: 1;
            flex: 1;
            width: 100%;
            height: 40px;
            line-height: 50px;
            font-size: 13px;
            color: #000;
            text-align: center;
        }

        nav .menu.selected {
            font-size: 14px;
            color: #000;
            font-weight: bolder;
            border-bottom: 1px solid #000
        }

        button {
            width: 90%;
            height: 40px;
            text-align: center;
            color: #FFF;
            background: #fc8622;
            margin: 15px auto;
            margin-left: 5%;
            border-radius: 4px
        }

        .cjtc {
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            box-sizing: border-box;
            background-color: rgba(0, 0, 0, 0.25);
            z-index: 1000000;
            display: none;
        }

        .cjtc .box {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
        }

        .cjtc .box .rw {
            box-sizing: border-box;
            ;
            width: 70px;
            height: 70px;
            border: 2px solid #fff;
            border-radius: 50%;
            overflow: hidden;
            position: absolute;
            left: 50%;
            top: 0;
            transform: translateX(-50%);
        }

        .cjtc .box .rw img {
            width: 100%;
            display: block;
        }

        .cjtc .box .te {
            width: 250px;
            height: 215px;
            box-sizing: border-box;
            background-color: #fff;
            margin-top: 35px;
            border-radius: 5px;
            overflow: hidden;
        }

        .cjtc .box .close {
            position: absolute;
            top: 45px;
            right: 10px;
            width: 7px;
            height: 7px;
            cursor: pointer;
        }

        .cjtc .box .close img {
            width: 100%;
            display: block;
        }

        .cjtc .box .te .text {
            padding: 0 22px;
            padding-top: 70px;
            width: 100%;
            box-sizing: border-box;
        }

        .cjtc .box .te .text .col {
            margin-bottom: 15px;
            position: relative;
            width: 100%;
            color: #999;
            font-size: 12px;
            vertical-align: middle;
        }

        .cjtc .box .te .text .col .img {
            width: 15px;
            margin-right: 9px;
            display: inline-block;
        }

        .cjtc .box .te .text .col img {
            display: block;
            margin: 0 auto;
            vertical-align: text-top;
        }

        .cjtc .box .te .text .col b {
            vertical-align: text-top;
        }

        .cjtc .box .te .text .col span {
            vertical-align: text-top;
            ;
        }

        .cjtc .box .te .text .col:first-child img {
            width: 11px;
            height: 12px;
        }

        .cjtc .box .te .text .col:first-child+.col img {
            width: 15px;
            height: 12px;
        }

        .cjtc .box .te .text .col:first-child+.col+.col img {
            width: 12px;
            height: 14px;
        }

        .cjtc .box .te .btn {
            height: 40px;
            bottom: 0;
            position: absolute;
            width: 100%;
            left: 0;
            border: 1px solid #e7e7e7;
            box-sizing: border-box;
            padding: 0
        }

        .cjtc .box .te .btn button {
            margin: 0;
            width: 49%;
            height: 100%;
            text-align: center;
            color: #666;
            font-size: 13px;
            background-color: rgba(0, 0, 0, 0);
            box-sizing: border-box;
            display: inline-block;
            padding: 0;
            outline: none
        }

        .cjtc .box .te .btn button:first-child {
            border-right: 1px solid #e7e7e7
        }

        .jjtc {
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            box-sizing: border-box;
            background-color: rgba(0, 0, 0, 0.25);
            z-index: 1000000;
            display: none;
        }

        .jjtc .box {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            background-color: #fff;
            width: 250px;
            height: 225px;
            border-radius: 4px;
            box-sizing: border-box;
            ;
            overflow: hidden
        }

        .jjtc .top {
            ;
            width: 100%;
            height: 40px;
            background-image: -moz-linear-gradient( 90deg, rgb(253, 139, 59) 0%, rgb(255, 106, 1) 100%);
            background-image: -webkit-linear-gradient( 90deg, rgb(253, 139, 59) 0%, rgb(255, 106, 1) 100%);
            background-image: -ms-linear-gradient( 90deg, rgb(253, 139, 59) 0%, rgb(255, 106, 1) 100%);
        }

        .jjtc .top h4 {
            text-align: center;
            color: #fff;
            font-size: 12px;
            line-height: 40px;
        }

        .jjtc .box .close {
            position: absolute;
            top: 17px;
            right: 10px;
            width: 7px;
            height: 7px;
            cursor: pointer;
        }

        .jjtc .box .close img {
            width: 100%;
            display: block;
        }

        .jjtc .box .tetx {
            width: 100%;
            height: 120px;
            box-sizing: border-box;
            padding: 25px 24px;
        }

        .jjtc .box .tetx .col {
            width: 96px;
            height: 30px;
            box-sizing: border-box;
            border-radius: 2px;
            text-align: center;
            ;
            color: #999;
            font-size: 12px;
            line-height: 30px;
            border: 1px solid #e7e7e7;
            float: left;
            margin-bottom: 10px;
        }

        .jjtc .box .tetx .col:nth-child(2n) {
            float: right;
        }

        .jjtc .box button {
            display: block;
            margin: 0 auto;
            width: 203px;
            height: 40px;
            box-sizing: border-box;
            color: #fff;
            font-size: 13px;
            text-align: center;
            line-height: 40px;
            background-color: #fc8622;
            border-radius: 2px
        }

        .checked {
            color: #fc8622!important;
            border-color: #fc8622!important
        }

        .clearfix {
            clear: both;
        }

        #nav {
            margin-left: 0;
            width: 100%;
            box-sizing: border-box;
            margin-bottom: 10px;
        }

        #tuoche_cont {
            position: relative;
        }

        .fenxiang {
            width: 22px;
            height: 22px;
            position: absolute;
            right: 20px;
            top: 35px;
            z-index: 999
        }
    </style>
</head>

<body>



    <div id="tuoche_cont">
        <img onclick="fxwx()" class="fenxiang" src="../../image/fxfx.png">
        <div id="top">
            <div class="left">
                <h3 id="biaoti">{{title}}</h3>
                <div class="fot"><span><img src="../../image/dizhi.png" ></span><span>{{dizhi}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span><img src="../../image/rili.png"></span> <span id="gqt">{{gongqi}}天工期</span></div>
            </div>
            <h4>{{time}}</h4>

        </div>



        <div id="lxr_cont">
            <div class="title">
                <span></span>
                <h3>项目联系人</h3>
            </div>
            <div class="cont_n">
                <div class="tou">
                    <img :src="touxiang">
                </div>
                <div class="cont_n_c">
                    <h4>{{name==""?"未命名":name}}</h4>
                    <img class="le" src="../../image/renzheng.png" v-if="ren">
                    <div class="dizhi">
                        <span>联系电话：<b id="phone">{{dianhua}}</b></span>
                        <span>    &nbsp;&nbsp;&nbsp;&nbsp;</span>
                    </div>
                </div>
            </div>
        </div>



        <div id="xm_cont">
            <div class="title">
                <span></span>
                <h3>项目需求</h3>
            </div>
            <div class="cont_n" style="height:90px">
                <p id="neir">{{zxxm}}</p>
            </div>
        </div>


        <div id="tp_cont">
            <div class="title">
                <span></span>
                <h3>项目地址</h3>
            </div>

        </div>


        <nav id="nav" v-if="cz">
            <div class="menu selected" tapmode="selected" onclick="fnSetNavMenuSelected(0)">参加机手</div>
            <div class="menu" tapmode="selected" onclick="fnSetNavMenuSelected(1)">拒绝机手</div>
        </nav>
        <div></div>
        <div class="xianshi xscl" v-if="cz">
            <div class="cont_n" v-for="site in cjjs">

                <div class="tou">
                    <img :src="site.touxiang">
                </div>
                <div class="cont_n_c">
                    <h4>{{site.name==""?"未命名":site.name}}</h4>
                    <img class="le" src="../../image/renzheng.png" v-if="site.ren">
                    <div class="dizhi">

                    </div>

                </div>
                <div class="clearfix"></div>
            </div>
        </div>
        <div class="xianshi ">
            <div class="cont_n" v-for="site in jjjs">

                <div class="tou">
                    <img :src="site.touxiang">
                </div>
                <div class="cont_n_c">
                    <h4>{{site.name==""?"未命名":site.name}}</h4>
                    <img class="le" src="../../image/renzheng.png" v-if="site.ren">
                    <div class="dizhi">


                    </div>

                </div>
                <div class="clearfix"></div>

            </div>
        </div>


        <button id="cyxmbtn" onclick="canjia()" tapmode>参与项目</button>
        <!--参加弹窗-->
        <div class="cjtc" id="cjtc">
            <div class="box">
                <div class="rw">
                    <img :src="touxiang" alt="">
                </div>
                <div class="te">
                    <div class="text">
                        <div class="col">
                            <div class="img">
                                <img src="../../image/lianxiren.png" alt="">
                            </div>
                            <span>联系人：{{name}}</span>
                            <!-- <img class="le" src="../../image/renzheng.png" > -->
                        </div>
                        <div class="col">
                            <div class="img">
                                <img src="../../image/dianhau.png" alt="">
                            </div>
                            <span>电   话：{{dianhua}}</span>
                        </div>
                        <div class="col">
                            <div class="img">
                                <img src="../../image/didian.png" alt="">
                            </div>
                            <b style="font-weight:normal">  地   点：<span style="display:inline-block;width:10em" id="xmdz">{{dizhi}}</span></b>
                        </div>
                        <div class="btn">
                            <button onclick="cjclosetc(2)">取消</button>
                            <button onclick="cjclosetc(1)">参加项目</button>
                        </div>
                    </div>
                    <div class="close" id="cjclosetc" onclick="cjclosetc()">
                        <img src="../../image/close1.png" alt="">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 拒绝弹窗 -->
    <style>
        .jjtc {
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            box-sizing: border-box;
            background-color: rgba(0, 0, 0, 0.25);
            z-index: 1000000;
            display: none;
        }

        .jjtc .box {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            background-color: #fff;
            width: 250px;
            height: 225px;
            border-radius: 4px;
            box-sizing: border-box;
            ;
            overflow: hidden
        }

        .jjtc .top {
            ;
            width: 100%;
            height: 40px;
            background-image: -moz-linear-gradient( 90deg, rgb(253, 139, 59) 0%, rgb(255, 106, 1) 100%);
            background-image: -webkit-linear-gradient( 90deg, rgb(253, 139, 59) 0%, rgb(255, 106, 1) 100%);
            background-image: -ms-linear-gradient( 90deg, rgb(253, 139, 59) 0%, rgb(255, 106, 1) 100%);
        }

        .jjtc .top h4 {
            text-align: center;
            color: #fff;
            font-size: 12px;
            line-height: 40px;
        }

        .jjtc .box .close {
            position: absolute;
            top: 17px;
            right: 10px;
            width: 7px;
            height: 7px;
            cursor: pointer;
        }

        .jjtc .box .close img {
            width: 100%;
            display: block;
        }

        .jjtc .box .tetx {
            width: 100%;
            height: 120px;
            box-sizing: border-box;
            padding: 25px 24px;
        }

        .jjtc .box .tetx .col {
            width: 96px;
            height: 30px;
            box-sizing: border-box;
            border-radius: 2px;
            text-align: center;
            ;
            color: #999;
            font-size: 12px;
            line-height: 30px;
            border: 1px solid #e7e7e7;
            float: left;
            margin-bottom: 10px;
        }

        .jjtc .box .tetx .col:nth-child(2n) {
            float: right;
        }

        .jjtc .box button {
            display: block;
            margin: 0 auto;
            width: 203px;
            height: 40px;
            box-sizing: border-box;
            color: #fff;
            font-size: 13px;
            text-align: center;
            line-height: 40px;
            background-color: #fc8622;
            border-radius: 2px
        }

        .checked {
            color: #fc8622!important;
            border-color: #fc8622!important
        }

        .clearfix {
            clear: both;
        }
    </style>
    <div class="jjtc" id="jjtc">
        <div class="box">
            <div class="top">
                <h4>选择拒绝理由</h4>
            </div>
            <div class="tetx">
                <div class="jjly col" onclick="jjthis()">
                    路程太远
                </div>
                <div class="jjly col">
                    时间不符
                </div>
                <div class="jjly col">
                    工资不够
                </div>
                <div class="jjly col">
                    其他原因
                </div>
                <div class="clearfix"></div>
            </div>
            <button>确认提交</button>
            <div class="close" id="cjclosetc1" onclick="cjclosetc()">
                <img src="../../image/close1.png" alt="">
            </div>
        </div>
    </div>
    <p id="tuisong_id" style="display: none"></p>
    <p id="tuisong_sf" style="display: none"></p>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript">
    var tuisong_id;
    apiready = function() {

        shenfen()
            //接收id
        id = api.pageParam.id;
        // console.log(id);
        //后请求数据
        api.showProgress({
            style: 'default',
            animationType: 'fade',
            title: '努力加载中...',
            text: '先喝杯茶...',
            modal: false
        });
        api.setRefreshHeaderInfo({
            loadingImg: 'widget://image/refresh.png',
            bgColor: '#fff',
            textColor: '#333',
            textDown: '下拉刷新...',
            textUp: '松开刷新...'
        }, function(ret, err) {
            ajax();

        });
        //请求数据
        ajax();
        //沉浸
        var header = $api.byId('header');
        headerH = $api.fixStatusBar(header);
        //vue
        show_tc = new Vue({
            el: '#tuoche_cont',
            data: {
                title: '',
                time: "",
                gongqi: "",
                zxxm: '',
                touxiang: '',
                name: '',
                dizhi: '',
                juli: '',
                dianhua: '',
                cjjs: [],
                jjjs: [],
                ren: false,
                cz: true,
                tongso_id: '',
                tongso_sf: ''

            }

        });
    };

    // 一键分享
    function fxwx() {
        var dialogBox = api.require('dialogBox');
        dialogBox.actionMenu({
            rect: {
                h: 150
            },
            texts: {
                cancel: '取消'
            },
            items: [{
                text: '微信好友',
                icon: 'widget://image/share/wx1.png'
            }, {
                text: '微信朋友圈',
                icon: 'widget://image/share/wx-circle1.png'
            }],
            styles: {
                bg: '#FFF',
                column: 2,
                itemText: {
                    color: '#000',
                    size: 12,
                    marginT: 8
                },
                itemIcon: {
                    size: 60
                },
                cancel: {
                    bg: 'fs://icon.png',
                    color: '#000',
                    h: 44,
                    size: 14
                }
            }
        }, function(ret) {
            //  alert(JSON.stringify(ret));
            if (ret.index == 0) {
                wxhy()
                dialogBox.close({
                    dialogName: "actionMenu"
                })
            } else if (ret.index == 1) {
                pyq()
                dialogBox.close({
                    dialogName: "actionMenu"
                })
            } else {
                dialogBox.close({
                    dialogName: "actionMenu"
                })
            }
            //  if(ret.buttonIndex==1)
        });
    }


    // 分享到朋友圈
    function pyq() {
        var wxPlus = api.require('wxPlus');
        wxPlus.isInstalled(function(ret, err) {
            if (ret.installed) {
                // alert("当前设备已安装微信客户端");
                wxPlus.shareText({
                    apiKey: '',
                    scene: 'timeline',
                    text: $api.byId('biaoti').innerHTML + '，' + $api.byId('neir').innerHTML + '；地址在' + $api.byId('xmdz').innerHTML + '。' + $api.byId('gqt').innerHTML + '。'

                }, function(ret, err) {
                    if (ret.status) {
                        api.toast({
                            msg: "分享成功",
                            duration: 2000,
                            location: 'bottom'
                        });
                    } else {
                        api.toast({
                            msg: "err.code",
                            duration: 2000,
                            location: 'bottom'
                        });

                    }
                });
            } else {
                api.toast({
                    msg: "当前设备未安装微信客户端",
                    duration: 2000,
                    location: 'bottom'
                });

            }
        });
        var wxPlus = api.require('wxPlus');
    }


    // 分享给微信好友
    function wxhy() {
        var wxPlus = api.require('wxPlus');
        wxPlus.isInstalled(function(ret, err) {
            if (ret.installed) {
                // alert("当前设备已安装微信客户端");
                wxPlus.shareText({
                    apiKey: '',
                    scene: 'session',
                    text: $api.byId('biaoti').innerHTML + '，' + $api.byId('neir').innerHTML + '；地址在' + $api.byId('xmdz').innerHTML + '。' + $api.byId('gqt').innerHTML + '。'

                }, function(ret, err) {
                    if (ret.status) {
                        api.toast({
                            msg: "分享成功",
                            duration: 2000,
                            location: 'bottom'
                        });
                    } else {
                        api.toast({
                            msg: "err.code",
                            duration: 2000,
                            location: 'bottom'
                        });

                    }
                });
            } else {
                api.toast({
                    msg: "当前设备未安装微信客户端",
                    duration: 2000,
                    location: 'bottom'
                });

            }
        });
        var wxPlus = api.require('wxPlus');
    }






    function shenfen() {
        var member = $api.getStorage("member");
        // console.log(member)
        if (member == null) {
            $api.text($api.byId('phone'), '');
            api.toast({
                msg: '您尚未登录，无法查看联系电话',
                duration: 2000,
                location: 'bottom'
            });

        }

    }

    var headerH, map, dialogBox, show_tc, id, fuid;


    function ditu(lon, lat) {
        map = api.require('bMap');
        map.open({
            rect: {
                x: 15,
                y: headerH + 415,
                w: api.frameWidth - 30,
                h: 200
            },
            center: {
                lon: lon,
                lat: lat
            },
            zoomLevel: 15,
            showUserLocation: true,
            fixedOn: api.frameName,
            fixed: false
        }, function(ret) {
            if (ret.status) {
                // console.log('地图打开成功');
            }
        });
        map.setMapAttr({
            scrollEnable: false
        });
        //大头针
        map.addAnnotations({
            annotations: [{
                id: 1,
                lon: lon,
                lat: lat
            }],

            draggable: true
        });
    }

    function photoview() {
        var photoBrowser = api.require('photoBrowser');
        photoBrowser.open({
            images: [
                'widget://image/banner2.png'
            ],
            placeholderImg: 'widget://image/banner2.png',
            bgColor: '#000'
        }, function(ret, err) {
            if (ret) {
                // console.log(JSON.stringify(ret));
            } else {
                // console.log(JSON.stringify(err));
            }
        });
    }
    function call(phone) {

        api.call({
            type: 'tel_prompt',
            number: phone
        });
    }


    function back() {
        map.close();
        api.closeFrame();
    }

    function fnSetNavMenuSelected(index_) {
        menus = $api.domAll(nav, '.menu');
        xianshis = $api.domAll(".xianshi");

        for (var i = 0; i < 3; i++) {
            if (index_ == i) {
                $api.addCls(xianshis[i], 'xscl');
                $api.addCls(menus[i], 'selected');
            } else {
                $api.removeCls(xianshis[i], 'xscl');
                $api.removeCls(menus[i], 'selected');
            }
        }
    }

    function canjia() {
        member = $api.getStorage("member");
        // console.log(member)
        var cyxmbtn = $api.byId("cyxmbtn")
        $api.text(cyxmbtn, '已报名项目');
        $api.css(cyxmbtn, 'background-color: #999');
        if (member == null) {
            api.openWin({
                name: 'login',
                url: 'widget://html/person/login_win.html',
                slidBackEnabled: false,
                pageParam: {
                    name: 'test'
                }
            });
        } else {
            var cjtc = $api.byId("cjtc")
            $api.css(cjtc, 'display:block')
            map.hide();
        }
    }

    function cjclosetc(data) {

        if (data == 1) {

            var cyxmbtn = $api.byId("cyxmbtn")
            $api.text(cyxmbtn, '已报名项目');
            $api.css(cyxmbtn, 'background-color: #999');
            // console.log(id);
            var code = 1
            api.ajax({
                    url: $api.getStorage("backapi") + '/index.php?s=xiangmu&c=home&m=insert_id&uid=' + $api.getStorage("member") + '&id=' + id + '&fuid=' + fuid,
                    method: 'get',
                },
                function(ret, err) {
                    if (ret) {

                        console.log(JSON.stringify(ret));
                        var cjtc = $api.byId("cjtc")
                        $api.css(cjtc, 'display:none')

                        map.show();

                        //  console.log(ret);
                    } else {
                        //console.log(JSON.stringify(err));
                        // console.log( JSON.stringify( err ) );
                        // var cyxmbtn=$api.byId("cyxmbtn")
                        // $api.text(cyxmbtn, '已报名项目');
                        // $api.css(cyxmbtn, 'background-color: #999');
                    }
                });

        } else {


            var cjtc = $api.byId("cjtc")
            $api.css(cjtc, 'display:none')

            map.show();
        }

    }



    function ajax() {
        api.ajax({
            url: $api.getStorage("backapi") + '/index.php?s=xiangmu&c=home&m=show_ajax&uid=' + id + "&member=" + $api.getStorage("member"),
            method: 'post',
        }, function(ret, err) {


            if (ret) {
                // console.log(ret.status.code)
                if (ret.status.ziji == "0") {
                    var cyxmbtn = $api.byId("cyxmbtn")
                    $api.text(cyxmbtn, '已报名项目');
                    $api.css(cyxmbtn, 'background-color: #999');
                }
                $api.text($api.byId('tuisong_id'), ret.status.id);
                $api.text($api.byId('tongso_sf'), ret.status.type);


                show_tc.title = ret.status.title;
                show_tc.time = ret.status.time;
                show_tc.gongqi = ret.status.gongqi;
                show_tc.touxiang = ret.status.tx;
                show_tc.name = ret.status.xingming;
                show_tc.dizhi = ret.status.dizhi;
                show_tc.zxxm = ret.status.xiangmuxuqiu;
                show_tc.dianhua = ret.status.phone;
                ditu(ret.status.lon, ret.status.lat);
                show_tc.cjjs = ret.status.canyu;
                show_tc.jjjs = ret.status.jujue;

                console.log(ret.status.lon)
                console.log(ret.status.lat)
                console.log('上面是地图中的坐标')

                if (ret.status.uid == $api.getStorage("member")) {
                    var cyxmbtn = $api.byId("cyxmbtn")
                    $api.css(cyxmbtn, 'display:none');
                }
                if (ret.status.type == 1) {
                    show_tc.ren = true
                }
                fuid = ret.status.uid;

                pdcy(ret.status.cyid, ret.status.jjid)
                api.hideProgress();
                api.refreshHeaderLoadDone();

            } else {
                api.hideProgress();
                api.refreshHeaderLoadDone();
                // console.log( JSON.stringify( err ) );
            }
        });

    }


    function pdcy(cy, jj) {

        if ($api.getStorage("member")) {
            var cyxmbtn = $api.byId("cyxmbtn")
            var cyarr = new Array();
            var jjarr = new Array();
            if (jj != null) {
                console.log(1);
                jjarr = jj.split(",");
            }
            if (cy != null) {
                console.log(2);
                cyarr = cy.split(",");
            }
            console.log(cyarr);
            console.log(jjarr);
            if (in_array($api.getStorage("member"), jjarr)) {
                $api.text(cyxmbtn, '已拒绝');
                document.getElementById("cyxmbtn").disabled = true;
                $api.css(cyxmbtn, 'background-color: #999');
            } else if (in_array($api.getStorage("member"), cyarr)) {
                $api.text(cyxmbtn, '已参加项目');
                document.getElementById("cyxmbtn").disabled = true;
                $api.css(cyxmbtn, 'background-color: #999');
            }
        } else {
            show_tc.cz = false
        }

    }


    function in_array(stringToSearch, arrayToSearch) {
        for (s = 0; s < arrayToSearch.length; s++) {
            thisEntry = arrayToSearch[s].toString();
            if (thisEntry == stringToSearch) {
                return true;
            }
        }
        return false;
    }
</script>

</html>
